﻿using B.S.GridManage.Api.Read.Application.Command.DutyGrid;
using B.S.GridManage.Api.Read.Application.Command.UnitGrid;
using B.S.GridManage.Api.Read.Dtos;
using B.S.GridManage.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.GridManage.Api.Read.Controllers
{
    /// <summary>
    /// 责任网格控制器,
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DutyController : ControllerBase
    {
        private readonly IMediator mediator;

        public DutyController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 获取单元网格分页列表
        /// </summary>
        /// <param name="request">查询参数</param>
        /// <returns>响应包装类</returns>
        [HttpGet]
        public  Task<ApiPaging<UnitGridDto>> GetUnitGridPages([FromQuery]GetUnitGridCommand request) { 
        
            return mediator.Send(request);
        }

        /// <summary>
        /// 获取责任网格列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public   Task<ApiResult<List<DutyDto>>> GetDutyGrid([FromQuery]GetDutyGridCommand request) { 
        
            return mediator.Send(request);

        }
    }
}
